
var tab;
var host = "admin.comment.sohu.com";
var tid = setTimeout(function() {
    host = "192.168.105.198";
}, 1000);
var img = new Image();
img.onload = function() {
    clearTimeout(tid);
};
img.onerror = function() {
    host = "192.168.105.198";
};
try {
    img.src = "http://" + host + "/";
} catch (Exception e) {}


chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    var action = request.action;
    if (action == "page") {
        chrome.pageAction.show(sender.tab.id);
        tab = sender.tab;
        sendResponse({"host": host});
    }
});

chrome.pageAction.onClicked.addListener(function(tab) {
    chrome.tabs.executeScript(tab.id, {
        file  : "js/page.js"
    });
});

